package health_system.health_system.service;


import health_system.health_system.dto.*;
import health_system.health_system.entity.MomentLike;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Map;
import java.util.Optional;

public interface MomentLikeService {
    
    /**
     * Like a moment
     */
    MomentLikeDTO likeMoment(MomentLikeCreateDTO likeCreateDTO);
    
    /**
     * Unlike a moment
     */
    void unlikeMoment(Long userId, Long momentId);
    
    /**
     * Check if a user has liked a moment
     */
    boolean hasUserLikedMoment(Long userId, Long momentId);
    
    /**
     * Get like by ID
     */
    MomentLikeDTO getLikeById(Long id);
    
    /**
     * Get like entity by ID (for internal use)
     */
    MomentLike getLikeEntityById(Long id);
    
    /**
     * Find like entity by ID (optional, for internal use)
     */
    Optional<MomentLike> findLikeEntityById(Long id);
    
    /**
     * Get like by user and moment
     */
    Optional<MomentLikeDTO> getLikeByUserAndMoment(Long userId, Long momentId);
    
    /**
     * Get all likes for a moment
     */
    List<MomentLikeDTO> getLikesByMomentId(Long momentId);
    
    /**
     * Get paginated likes for a moment
     */
    PageResponseDTO<MomentLikeDTO> getLikesByMomentId(Long momentId, Pageable pageable);
    
    /**
     * Get all moments liked by a user
     */
    List<MomentDTO> getMomentsLikedByUser(Long userId);
    
    /**
     * Get paginated moments liked by a user
     */
    PageResponseDTO<MomentDTO> getMomentsLikedByUser(Long userId, Pageable pageable);
    
    /**
     * Count likes for a moment
     */
    Long countLikesByMomentId(Long momentId);
    
    /**
     * Count likes by user
     */
    Long countLikesByUserId(Long userId);
    
    /**
     * Get all users who liked a moment
     */
    List<UserDTO> getUsersWhoLikedMoment(Long momentId);
    
    /**
     * Get paginated users who liked a moment
     */
    PageResponseDTO<UserDTO> getUsersWhoLikedMoment(Long momentId, Pageable pageable);
    
    /**
     * Get moments with most likes visible to user
     */
    List<MomentWithStatsDTO> getMomentsWithMostLikesVisibleToUser(Long viewerId, Pageable pageable);
    
    /**
     * Get recently liked moments by friends
     */
    List<MomentDTO> getRecentlyLikedMomentsByFriends(Long userId, Pageable pageable);

    /**
     * Batch check if user has liked multiple moments
     */
    Map<Long, Boolean> batchCheckUserLikedMoments(Long userId, List<Long> momentIds);
    
    /**
     * Batch get like counts for multiple moments
     */
    Map<Long, Long> batchGetLikeCountsForMoments(List<Long> momentIds);
} 